/*
 *  PMFloat.h
 *  PezMonkey
 *
 *  Created by Spence DiNicolantonio on 11/4/09.
 *  Copyright 2009 Necrosoft. All rights reserved.
 *
 */

#import "PMCore.h"

/**
 * Defines PMFloat primitive data type. The Chipmunk source is altered to use 
 * floats unless the kDoublePrecision setting is turned on.
 */
typedef cpFloat PMFloat;

/**
 * Returns the greater of two given values.
 */
static inline PMFloat PMFloatMax(PMFloat a, PMFloat b) {
	return (a > b) ? a : b;
}

/**
 * Returns the lesser of two given values.
 */
static inline PMFloat PMFloatMin(PMFloat a, PMFloat b) {
	return (a < b) ? a : b;
}

/**
 * Clamps a given float to a given [min, max] range.
 */
static inline PMFloat PMFloatClamp(PMFloat f, PMFloat min, PMFloat max){
	return PMFloatMin(PMFloatMax(f, min), max);
}